#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# @Time    : 2020/9/28 16:55
# @File    : admin
# @Author  : 
# @Email   : 
# @remark  :

from flask import Blueprint, render_template

from FAMS.views import adminOpera

admin = Blueprint('admin', __name__)


@admin.route('/')
def index():
    token = adminOpera.getDingToken()
    departmetnList = adminOpera.getDingDepartmentIdList(token)
    # print('部门名：'+departmetnList[0]['name'])
    adminOpera.updataDepartmentInfoSql(departmetnList)
    return token


@admin.route('/UpdataUser')
def UpdataUser():
    tempStr = 'Fail'
    token = adminOpera.getDingToken()
    dingUserInfoList=adminOpera.getDingUserInfoList(token)
    if(adminOpera.updataDbUserInfoList(dingUserInfoList)==1):
        tempStr='Success'
    return tempStr